////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2008 Michiel Helvensteijn                                    //
//                                                                            //
// This file is part of the Mist compiler.                                    //
//                                                                            //
// The Mist compiler is free software: you can redistribute it and/or modif   //
// it under the terms of the GNU General Public License as published by       //
// the Free Software Foundation, either version 3 of the License, or          //
// (at your option) any later version.                                        //
//                                                                            //
// The Mist compiler is distributed in the hope that it will be useful,       //
// but WITHOUT ANY WARRANTY; without even the implied warranty of             //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              //
// GNU General Public License for more details.                               //
//                                                                            //
// You should have received a copy of the GNU General Public License          //
// along with the Mist compiler.  If not, see <http://www.gnu.org/licenses/>. //
////////////////////////////////////////////////////////////////////////////////

#ifndef PARAMETERPOLICY_HPP
#define PARAMETERPOLICY_HPP

/******************************************************************************
 * Includes                                                                   *
 ******************************************************************************/

#include <boost/shared_ptr.hpp>
using boost::shared_ptr;

#include <boost/operators.hpp>
using boost::equality_comparable;

#include "accesstype.hpp"

/******************************************************************************
 * ParameterPolicy class                                                      *
 ******************************************************************************/

class ParameterPolicy : public equality_comparable<ParameterPolicy> {
	public:
		static const shared_ptr<ParameterPolicy> ByValue;
		static const shared_ptr<ParameterPolicy> ByReference;
		static const shared_ptr<ParameterPolicy> ByAlias;
		
		ParameterPolicy(string n, AccessType aa, bool ip, bool vp, AccessType fa, bool ir, bool vr) :
			name(n),
			actualAccess(aa), identityPassed(ip), valuePassed(vp),
			formalAccess(fa), identityReturned(ir), valueReturned(vr) {}
		
		bool operator==(const ParameterPolicy& other) const;
		
		string name;
		
		AccessType actualAccess;
		bool identityPassed;
		bool valuePassed;
		
		AccessType formalAccess;
		bool identityReturned;
		bool valueReturned;
};

/******************************************************************************
 * Convenience Functions                                                      *
 ******************************************************************************/

string to_string(AccessType accessType);

#endif // PARAMETERPOLICY_HPP
